.class final Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;
.super Lcom/burstly/lib/component/networkcomponent/burstly/html/BurstlyBaseScriptAdaptor;
.source "RewardsScriptAdaptor.java"


# static fields
.field private static final SCRIPT_INTERFACE_NAME:Ljava/lang/String; = "ScriptActivity"


# instance fields
.field mUrlProvider:Lcom/burstly/lib/component/networkcomponent/burstly/html/UrlProvider;


# direct methods
.method constructor <init>(Landroid/content/Context;Ljava/lang/String;)V
    .locals 0
    .parameter "context"
    .parameter "viewId"

    .prologue
    .line 53
    invoke-direct {p0, p1, p2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/BurstlyBaseScriptAdaptor;-><init>(Landroid/content/Context;Ljava/lang/String;)V

    .line 54
    return-void
.end method

.method private loadAd(Z)V
    .locals 5
    .parameter "isPrecached"

    .prologue
    .line 96
    invoke-virtual {p0, p1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->setPrecacheInterstitialRequest(Z)V

    .line 97
    new-instance v1, Lcom/burstly/lib/component/networkcomponent/burstly/html/WebViewFactory;

    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->getContext()Landroid/content/Context;

    move-result-object v2

    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->getResponseData()Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;

    move-result-object v3

    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->getFullResponse()Lcom/burstly/lib/network/beans/ResponseBean;

    move-result-object v4

    invoke-direct {v1, v2, v3, v4}, Lcom/burstly/lib/component/networkcomponent/burstly/html/WebViewFactory;-><init>(Landroid/content/Context;Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;Lcom/burstly/lib/network/beans/ResponseBean;)V

    .line 98
    .local v1, mFactory:Lcom/burstly/lib/component/networkcomponent/burstly/html/WebViewFactory;
    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->isFullscreen()Z

    move-result v2

    invoke-virtual {v1, p0, v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/WebViewFactory;->createImplementation(Lcom/burstly/lib/component/networkcomponent/burstly/html/WebViewFactory$IFactoryCallback;Z)V

    .line 100
    if-nez p1, :cond_0

    .line 101
    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->onInterstitialHtmlLoaded()V

    .line 105
    :goto_0
    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->mUrlProvider:Lcom/burstly/lib/component/networkcomponent/burstly/html/UrlProvider;

    invoke-virtual {v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/UrlProvider;->getUrl()Ljava/lang/String;

    move-result-object v2

    iget-object v3, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->mDataToPost:Ljava/lang/String;

    if-eq v2, v3, :cond_1

    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->mDataToPost:Ljava/lang/String;

    .line 106
    .local v0, dataToPost:Ljava/lang/String;
    :goto_1
    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->mUrlProvider:Lcom/burstly/lib/component/networkcomponent/burstly/html/UrlProvider;

    invoke-virtual {v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/UrlProvider;->getUrl()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {p0, v2, v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->postRequest(Ljava/lang/String;Ljava/lang/String;)V

    .line 107
    return-void

    .line 103
    .end local v0           #dataToPost:Ljava/lang/String;
    :cond_0
    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->getWebView()Lcom/burstly/lib/util/UiSafeWebView;

    move-result-object v2

    new-instance v3, Lcom/burstly/lib/component/networkcomponent/burstly/html/BurstlyBaseScriptAdaptor$InterstitialLoadedWebViewClient;

    invoke-direct {v3, p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/BurstlyBaseScriptAdaptor$InterstitialLoadedWebViewClient;-><init>(Lcom/burstly/lib/component/networkcomponent/burstly/html/BurstlyBaseScriptAdaptor;)V

    invoke-virtual {v2, v3}, Lcom/burstly/lib/util/UiSafeWebView;->setWebViewClient(Landroid/webkit/WebViewClient;)V

    goto :goto_0

    .line 105
    :cond_1
    const/4 v0, 0x0

    goto :goto_1
.end method


# virtual methods
.method protected checkParameters(Ljava/util/Map;)V
    .locals 3
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "*>;)V"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/IllegalArgumentException;
        }
    .end annotation

    .prologue
    .line 58
    .local p1, paramsFromServer:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;*>;"
    invoke-super {p0, p1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/BurstlyBaseScriptAdaptor;->checkParameters(Ljava/util/Map;)V

    .line 59
    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->getResponseData()Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;

    move-result-object v0

    .line 60
    .local v0, responseData:Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;
    new-instance v1, Lcom/burstly/lib/component/networkcomponent/burstly/html/UrlProvider;

    invoke-virtual {v0}, Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;->getUrl()Ljava/lang/String;

    move-result-object v2

    invoke-direct {v1, v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/UrlProvider;-><init>(Ljava/lang/String;)V

    iput-object v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->mUrlProvider:Lcom/burstly/lib/component/networkcomponent/burstly/html/UrlProvider;

    .line 76
    const/4 v1, 0x1

    invoke-virtual {p0, v1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->setFullscreen(Z)V

    .line 77
    invoke-virtual {v0}, Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;->getData()Ljava/lang/String;

    move-result-object v1

    iput-object v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->mDataToPost:Ljava/lang/String;

    .line 78
    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->mUrlProvider:Lcom/burstly/lib/component/networkcomponent/burstly/html/UrlProvider;

    invoke-virtual {v1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/UrlProvider;->getUrl()Ljava/lang/String;

    move-result-object v1

    if-nez v1, :cond_0

    .line 79
    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->mUrlProvider:Lcom/burstly/lib/component/networkcomponent/burstly/html/UrlProvider;

    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->mDataToPost:Ljava/lang/String;

    invoke-virtual {v1, v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/UrlProvider;->setUrl(Ljava/lang/String;)V

    .line 81
    :cond_0
    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->mUrlProvider:Lcom/burstly/lib/component/networkcomponent/burstly/html/UrlProvider;

    invoke-virtual {v1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/UrlProvider;->getUrl()Ljava/lang/String;

    move-result-object v1

    const-string v2, "Url for rewards can not be null"

    invoke-static {v1, v2}, Lcom/burstly/lib/util/Utils;->checkNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    .line 82
    return-void
.end method

.method protected createFullscreenOverlay()Lcom/burstly/lib/component/networkcomponent/burstly/html/ScriptInterstitialOverlay;
    .locals 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Lcom/burstly/lib/component/networkcomponent/burstly/html/ScriptInterstitialOverlay",
            "<*>;"
        }
    .end annotation

    .prologue
    .line 117
    new-instance v1, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsFullscreenOverlay;

    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->getWebView()Lcom/burstly/lib/util/UiSafeWebView;

    move-result-object v0

    check-cast v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;

    invoke-direct {v1, v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsFullscreenOverlay;-><init>(Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;)V

    return-object v1
.end method

.method protected doGetNewAd()Landroid/view/View;
    .locals 1

    .prologue
    .line 86
    const/4 v0, 0x0

    invoke-direct {p0, v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->loadAd(Z)V

    .line 87
    const/4 v0, 0x0

    return-object v0
.end method

.method public getAdType()Lcom/burstly/lib/component/IBurstlyAdaptor$BurstlyAdType;
    .locals 1

    .prologue
    .line 127
    sget-object v0, Lcom/burstly/lib/component/IBurstlyAdaptor$BurstlyAdType;->INTERSTITIAL_AD_TYPE:Lcom/burstly/lib/component/IBurstlyAdaptor$BurstlyAdType;

    return-object v0
.end method

.method public onShowOverlay()V
    .locals 1

    .prologue
    .line 143
    invoke-super {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/BurstlyBaseScriptAdaptor;->onShowOverlay()V

    .line 144
    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->isPrecacheInterstitialRequest()Z

    move-result v0

    if-nez v0, :cond_0

    .line 145
    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->getWebView()Lcom/burstly/lib/util/UiSafeWebView;

    move-result-object v0

    check-cast v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/LoadingAwareWebView;

    invoke-virtual {v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/LoadingAwareWebView;->showLoadingBar()Lcom/burstly/lib/component/networkcomponent/burstly/html/LoadingAwareWebView;

    .line 147
    :cond_0
    return-void
.end method

.method public precacheAd()Landroid/view/View;
    .locals 4

    .prologue
    .line 111
    sget-object v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->LOG:Lcom/burstly/lib/util/LoggerExt;

    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->mTag:Ljava/lang/String;

    const-string v2, "Precache rewards banner currently not supported"

    const/4 v3, 0x0

    new-array v3, v3, [Ljava/lang/Object;

    invoke-virtual {v0, v1, v2, v3}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 112
    const/4 v0, 0x0

    return-object v0
.end method

.method public precacheInterstitialAd()V
    .locals 1

    .prologue
    .line 122
    const/4 v0, 0x1

    invoke-direct {p0, v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/RewardsScriptAdaptor;->loadAd(Z)V

    .line 123
    return-void
.end method

.method public rewardsViewCreated(Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;)V
    .locals 1
    .parameter "view"

    .prologue
    .line 137
    invoke-super {p0, p1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/BurstlyBaseScriptAdaptor;->rewardsViewCreated(Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;)V

    .line 138
    const-string v0, "ScriptActivity"

    invoke-virtual {p1, p1, v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsView;->addJavascriptInterface(Ljava/lang/Object;Ljava/lang/String;)V

    .line 139
    return-void
.end method

.method public supports(Ljava/lang/String;)Z
    .locals 1
    .parameter "action"

    .prologue
    .line 132
    sget-object v0, Lcom/burstly/lib/component/IBurstlyAdaptor$AdaptorAction;->PRECACHE_INTERSTITIAL:Lcom/burstly/lib/component/IBurstlyAdaptor$AdaptorAction;

    invoke-virtual {v0}, Lcom/burstly/lib/component/IBurstlyAdaptor$AdaptorAction;->getCode()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    return v0
.end method
